<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Cart extends Model
{
    protected $guarded = [];

    //购物车列表查询
    public function carts($user_id, $cart_ids = []) {
        $query = $this::query();
        if ($user_id) {
            $query->where('user_id', $user_id);
        }
        //if ($cart_ids) {
            $query->whereIn('id', $cart_ids);
        //}
        return $query->get();
    }
}
